package com.zhuangxiaoyan.jvm.chapter11.java2;

/**
 * @description TODO
  * @param: null
 * @date: 2022/6/18 17:03
 * @return:
 * @author: xjl
*/
public class StringExer2 {
    public static void main(String[] args) {
        String s1 = new String("ab");//执行完以后，会在字符串常量池中会生成"ab"
//        String s1 = new String("a") + new String("b");////执行完以后，不会在字符串常量池中会生成"ab"
        s1.intern();
        String s2 = "ab";
        System.out.println(s1 == s2);
    }
}
